import 'package:flutter/material.dart';
import 'package:flutter_framework/routes/home/home_routes.dart';
import 'package:flutter_framework/utils/logs.dart';
import 'package:get/get.dart';

class TestRouter extends StatefulWidget {
  const TestRouter({super.key});

  @override
  State<TestRouter>  createState() => _TestRouterState();
}
class _TestRouterState extends State<TestRouter> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title:const Text('GET路由传参'),centerTitle: true,
      ),
      body: ListView(children: [
        ListTile(
          title:const Text( '路径传参问号',),
          leading:const Icon(Icons.file_present),
          onTap: (){
           Get.toNamed('${HomeRouter.testRouterDetailUrl}?id=111');
           logs('${Get.routeTree.routes.toString()}');
          },
        ),
        const Divider(color: Colors.grey,),
        ListTile(
          title:const Text( 'argument传参',),
          leading:const Icon(Icons.file_present),
          onTap: (){
            Get.toNamed(HomeRouter.testRouterArgDetailUrl,arguments: {
              'id':'1041153622'
            });
            logs('${Get.routeTree.routes.toString()}');
          },
        ),
        const Divider(color: Colors.grey,),
        ListTile(
          title:const Text( 'path 传参',),
          leading:const Icon(Icons.file_present),
          onTap: (){
            Get.toNamed('${HomeRouter.testRouterPathDetailUrl}11223344',);
          },
        ),
        const Divider(color: Colors.grey,),
      ],)
    );
  }
}